package com.yanqu.road.server.logic.activity;

import com.yanqu.road.entity.activity.ActivityConditionInfo;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.UserActivityConditionData;
import com.yanqu.road.entity.enums.eActivityType;
import com.yanqu.road.entity.enums.eGamePlayerEventType;
import com.yanqu.road.entity.enums.eMailType;
import com.yanqu.road.entity.enums.ePlayerAttrType;
import com.yanqu.road.logic.helper.UnionActivityTaskConditionHelper;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.ActivityModule;
import com.yanqu.road.server.gameplayer.module.player.AttributeModule;
import com.yanqu.road.server.logic.activity.condition.BaseActivityCondition;
import com.yanqu.road.server.logic.mail.MailManager;
import com.yanqu.road.server.manger.MultipleLanguageMgr;
import com.yanqu.road.server.manger.activity.ActivityMgr;
import com.yanqu.road.server.manger.activity.NormalActivityMgr;
import com.yanqu.road.utils.LocalDateTimeHelper;
import com.yanqu.road.utils.date.DateHelper;
import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.property.PropertyHelper;
import com.yanqu.road.utils.string.StringUtils;

import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class BaseActivityData {

    protected GamePlayer player;

    private ActivityInfo activityInfo;

    private List<BaseActivityCondition> baseActivityConditionList;

    private List<UserActivityConditionData> userActivityConditionDataList;

    public BaseActivityData(GamePlayer player, ActivityInfo activityInfo, List<BaseActivityCondition> baseActivityConditionList,
                            List<UserActivityConditionData> userActivityConditionDataList) {
        this.player = player;
        this.activityInfo = activityInfo;
        this.baseActivityConditionList = baseActivityConditionList;
        this.userActivityConditionDataList = userActivityConditionDataList;
    }

    public final void addToPlayer(GamePlayer player) {
        // 未完成状态
        for (BaseActivityCondition baseActivityCondition : baseActivityConditionList) {
            int conditionId = baseActivityCondition.getActivityConditionInfo().getConditionId();
            UserActivityConditionData userActivityConditionData = getUserActivityConditionData(conditionId);
            if ((null != userActivityConditionData && !userActivityConditionData.isGetReward()) ||
                    isAlwaysNotice(userActivityConditionData) || isLiveShowCondition(userActivityConditionData)
            ) {
                addTrigger(conditionId);
            }
        }
    }

    //有一些活动比如商会充值他的充值触发器必须是要一直存在的
    private boolean isAlwaysNotice(UserActivityConditionData userActivityConditionData){
        if(null != userActivityConditionData && userActivityConditionData.getType() == eGamePlayerEventType.UnionRechargeUser.getValue()){
            return true;
        }
        // 商会成就、商会七日任务，自己完成了还可以继续帮别人完成
        if (null != userActivityConditionData && UnionActivityTaskConditionHelper.isUnionActivityConditionType(userActivityConditionData.getType())) {
            return true;
        }
        //烟花祈愿全服喜庆值要一直涨，到活动结束才结束
        if (null != userActivityConditionData && userActivityConditionData.getType() == eGamePlayerEventType.FireWorkHappyValue.getValue()) {
            return true;
        }
        //全服团购每天重置,也要一直存在
        if (null != userActivityConditionData && userActivityConditionData.getType() == eGamePlayerEventType.SeasonServerMallBuyTask.getValue()) {
            return true;
        }
        return false;
    }

    public void addTrigger(int conditionId) {
        for (BaseActivityCondition baseActivityCondition : baseActivityConditionList) {
            if (null != baseActivityCondition && baseActivityCondition.getConditionId() == conditionId) {
                baseActivityCondition.addTrigger(player);
            }
        }
    }

    private void removeTrigger(int conditionId) {
        for (BaseActivityCondition baseActivityCondition : baseActivityConditionList) {
            if (null != baseActivityCondition && baseActivityCondition.getConditionId() == conditionId) {
                baseActivityCondition.removeTrigger(player);
            }
        }
    }

    /**
     * 完成任务领取奖励
     */
    public final void finish(int conditionId) {
        removeTrigger(conditionId);
    }

    public final boolean canCompleted(int conditionId) {
        BaseActivityCondition baseActivityCondition = getBaseActivityCondition(conditionId);
        if(null != baseActivityCondition){
            return baseActivityCondition.isCompleted(player);
        }
        return false;
    }

    public void initRechargeConditionData() {
        for (BaseActivityCondition baseActivityCondition : baseActivityConditionList) {
            baseActivityCondition.initRechargeConditionData();
        }
    }

    public GamePlayer getPlayer() {
        return player;
    }

    public List<BaseActivityCondition> getBaseActivityConditionList() {
        return baseActivityConditionList;
    }

    public List<UserActivityConditionData> getUserActivityConditionDataList() {
        return userActivityConditionDataList;
    }

    public boolean isContinueAddCondition(int type){
        if(!ActivityMgr.isRankActivityCondition(activityInfo, type)){
            if(eGamePlayerEventType.LiveShowTime.getValue() == type){
                return player.getModule(AttributeModule.class).getAttribute(ePlayerAttrType.FirstLiveShowReward) <= 0;
            }else {
                return true;
            }
        }else {
            for (BaseActivityCondition baseActivityCondition : baseActivityConditionList) {
                if(baseActivityCondition.getConditionType() == type){
                    return false;
                }
            }
            return true;
        }
    }

    public boolean isContainCondition(int conditionId) {
        if (null != userActivityConditionDataList) {
            for (UserActivityConditionData userActivityConditionData : userActivityConditionDataList) {
                if (userActivityConditionData.getConditionId() == conditionId) {
                    return true;
                }
            }
        }
        return false;
    }

    public UserActivityConditionData getFirstUserActivityConditionData() {
        return userActivityConditionDataList.get(0);
    }

    public UserActivityConditionData getFirstUserActivityConditionDataByType(int conditionType) {
        for(UserActivityConditionData userActivityConditionData : userActivityConditionDataList){
            if(userActivityConditionData.getType() == conditionType){
                return userActivityConditionData;
            }
        }
        return null;
    }

    public BaseActivityCondition getFirstBaseActivityConditionByType(int conditionType) {
        for (BaseActivityCondition baseActivityCondition : baseActivityConditionList) {
            if (baseActivityCondition.getConditionType() == conditionType) {
                return baseActivityCondition;
            }
        }
        return null;
    }

    public UserActivityConditionData getUserActivityConditionData(int conditionId) {
        for (UserActivityConditionData userActivityConditionData : userActivityConditionDataList) {
            if (userActivityConditionData.getConditionId() == conditionId) {
                return userActivityConditionData;
            }
        }
        return null;
    }

    public Map<Integer, BigInteger> getMaxUserActivityConditionData() {
        Map<Integer, BigInteger> dataMap = new ConcurrentHashMap<>();
        if (null != userActivityConditionDataList) {
            for (UserActivityConditionData userActivityConditionData : userActivityConditionDataList) {
                if(!dataMap.containsKey(userActivityConditionData.getType())) {
                    dataMap.put(userActivityConditionData.getType(), BigInteger.ZERO);
                }
                BigInteger maxValue = dataMap.get(userActivityConditionData.getType());
                if (userActivityConditionData.getValue().compareTo(maxValue) > 0) {
                    dataMap.put(userActivityConditionData.getType(), userActivityConditionData.getValue());
                }
            }
        }
        return dataMap;
    }

    public BaseActivityCondition getBaseActivityCondition(int conditionId) {
        for (BaseActivityCondition baseActivityCondition : baseActivityConditionList) {
            if (baseActivityCondition.getConditionId() == conditionId) {
                return baseActivityCondition;
            }
        }
        return null;
    }

    public ActivityInfo getActivityInfo() {
        return activityInfo;
    }

    public int getActivityId(){
        if(null != activityInfo){
            return activityInfo.getActivityId();
        }
        return 0;
    }

    // 重置日常任务
    public final void resetTask() {
        // 每日领取的任务 则重置
        if (Integer.parseInt(activityInfo.getParam2()) == 2 && activityInfo.getType() != eActivityType.CricketSeasonActivity.getValue()) {
            resetDailyTask();
        }
        // 部分活动要重置
        if (activityInfo.getType() == eActivityType.NewYearBag.getValue()
        || (activityInfo.getType() == eActivityType.SuiTang.getValue() && ActivityMgr.activityInTime(activityInfo))
        || (activityInfo.getType() == eActivityType.ChuHanZB.getValue() && ActivityMgr.activityInTime(activityInfo))) {
            resetDailyTaskByParam5();
        }
        if (activityInfo.getType() == eActivityType.Advertisement.getValue()) {
            resetAdDailyTask();
        }
    }

    private void resetDailyTask() {
        long zeroTime = LocalDateTimeHelper.getZeroTimeTimeStamp() / 1000;
        for (UserActivityConditionData userActivityConditionData : userActivityConditionDataList) {
            if (userActivityConditionData.getModifyTime() < zeroTime) {
                resetBaseActivityCondition(userActivityConditionData.getConditionId());
            }
        }
    }

    private void resetDailyTaskByParam5() {
        Map<Integer, BaseActivityCondition> baseCondMap = new HashMap<>();
        for (BaseActivityCondition baseCond : baseActivityConditionList) {
            baseCondMap.put(baseCond.getConditionId(), baseCond);
        }

        long zeroTime = LocalDateTimeHelper.getZeroTimeTimeStamp() / 1000;
        for (UserActivityConditionData userActivityConditionData : userActivityConditionDataList) {
            BaseActivityCondition baseCond = baseCondMap.get(userActivityConditionData.getConditionId());
            if (baseCond == null) {
                continue;
            }
            List<BigInteger> paramList = baseCond.getActivityConditionInfo().getParamList();
            if (paramList.size() < 5 || baseCond.getActivityConditionInfo().getParamList().get(4).intValue() != 1) {
                continue;
            }
            if (userActivityConditionData.getModifyTime() >= zeroTime) {
                continue;
            }
            // 重置
            baseCond.setValue(BigInteger.ZERO);
            baseCond.setPreValue(BigInteger.ZERO);
            baseCond.setGetReward(false);
            baseCond.setModifyTime(System.currentTimeMillis() / 1000);
            baseCond.addTrigger(player);
        }
    }

    public void resetReturnTask() {
        if (activityInfo.getType() != eActivityType.OldPlayerReturn.getValue()) {
            return;
        }
        for (UserActivityConditionData conditionData : userActivityConditionDataList) {
            if (conditionData.getType() == eGamePlayerEventType.OldPlayerReturnBindRole.getValue()) {
                continue;
            }
            conditionData.setValue(BigInteger.ZERO);
            conditionData.setPreValue(BigInteger.ZERO);
            conditionData.setGetReward(false);
            conditionData.setModifyTime(System.currentTimeMillis() / 1000);
            conditionData.setParam("");
        }

        for (BaseActivityCondition condition : baseActivityConditionList) {
            if (condition.getConditionType() == eGamePlayerEventType.OldPlayerReturnBindRole.getValue()) {
                continue;
            }
            condition.addTrigger(player);
        }
    }

    /**
     * 描述:重置广告每日活动条件
     */
    public void resetAdDailyTask() {
        if (activityInfo.getType() != eActivityType.Advertisement.getValue()) {
            return;
        }
        long zeroTime = LocalDateTimeHelper.getZeroTimeTimeStamp() / 1000;
        Property property = new Property();
        for (UserActivityConditionData userActivityConditionData : userActivityConditionDataList) {
            if (userActivityConditionData.getType() != eGamePlayerEventType.AdvertisementDailyResetCondition.getValue()) {
                continue;
            }

            if (userActivityConditionData.getModifyTime() < zeroTime) {
                BaseActivityCondition baseActivityCondition = getBaseActivityCondition(userActivityConditionData.getConditionId());
                //如果没领奖并且可以领奖 但是要被重置掉了
                if (!userActivityConditionData.isGetReward() && baseActivityCondition != null && baseActivityCondition.isCompleted(player)){
                    //保险 万一下面没跑
                    userActivityConditionData.setGetReward(true);
                    property.addProperty(baseActivityCondition.getActivityConditionInfo().getReward());
                }
                //重置任务
                resetBaseActivityCondition(userActivityConditionData.getConditionId());
            }
        }
        if (!property.isNothing()){
            String language = player.getLanguage();
            String activityName = ActivityMgr.getActivityName(activityInfo, language);
            String mailTitle = StringUtils.format(MultipleLanguageMgr.getContent(MailManager.TREASURE_ACTIVITY_PROGRESS_REWORD_TITLE, language), activityName);
            String mailContent = StringUtils.format(MultipleLanguageMgr.getContent(MailManager.TREASURE_ACTIVITY_PROGRESS_REWORD_CONTENT, language),
                    activityName);
            MailManager.sendMail(player.getUserId(), eMailType.SYSTEM.getValue(), PropertyHelper.parsePropertyToString(property), mailContent, mailTitle);
        }

    }


    /**
    * 描述：直播活动重置
    * 作者：zrq
    * 时间：2022/12/1
    * 参数：

    * 返回值：
    **/
    public void resetLiveShowTask() {
        if (activityInfo.getType() != eActivityType.PlatformActivity.getValue() ||
            66 != activityInfo.getChildType()
        ) {
            return;
        }
        long zeroTime = LocalDateTimeHelper.getZeroTimeTimeStamp() / 1000;
        boolean isGetResetTime = false;
        long lastResetTime = 0;
        for (UserActivityConditionData userActivityConditionData : userActivityConditionDataList) {
            if (userActivityConditionData.getType() == eGamePlayerEventType.LiveShowTime.getValue()) {
                continue;
            }
            if(userActivityConditionData.getType() == eGamePlayerEventType.LiveShowDailyTime.getValue() ||
                userActivityConditionData.getType() == eGamePlayerEventType.LiveShowWasheWinTimes.getValue()
            ) {
                if (userActivityConditionData.getModifyTime() < zeroTime) {
                    resetBaseActivityCondition(userActivityConditionData.getConditionId());
                }
            }else if(userActivityConditionData.getType() == eGamePlayerEventType.LiveShowDay.getValue()){
                if(!isGetResetTime) {
                    int resetDays = StringUtils.string2intSafe(activityInfo.getParam3(), 0);
                    lastResetTime = LocalDateTimeHelper.getZeroTimeTimeStamp(activityInfo.getBeginShowTime() * 1000) / 1000;
                    long nextResetTime = activityInfo.getBeginShowTime() + resetDays * DateHelper.DAY_SECONDS;
                    nextResetTime = LocalDateTimeHelper.getZeroTimeTimeStamp(nextResetTime * 1000) / 1000;
                    while (nextResetTime <= zeroTime) {
                        lastResetTime = nextResetTime;
                        nextResetTime = lastResetTime + resetDays * DateHelper.DAY_SECONDS;
                    }
                    isGetResetTime = true;
                }
                if (userActivityConditionData.getModifyTime() < lastResetTime) {
                    for (BaseActivityCondition baseActivityCondition : baseActivityConditionList) {
                        if (baseActivityCondition.getConditionId() == userActivityConditionData.getConditionId()) {
                            baseActivityCondition.setParam("");
                            baseActivityCondition.setValue(BigInteger.ZERO);
                            baseActivityCondition.setPreValue(BigInteger.ZERO);
                            baseActivityCondition.setGetReward(false);
                            baseActivityCondition.setModifyTime(lastResetTime);
                            baseActivityCondition.addTrigger(player);
                        }
                    }
                }
            }
        }
    }

    /**
    * 描述：直播重置任务类型
    * 作者：zrq
    * 时间：2022/12/10
    * 参数：

    * 返回值：
    **/
    private boolean isLiveShowCondition(UserActivityConditionData userActivityConditionData){
        if(null != userActivityConditionData){
            if(userActivityConditionData.getType() == eGamePlayerEventType.LiveShowDailyTime.getValue() ||
                userActivityConditionData.getType() == eGamePlayerEventType.LiveShowDay.getValue() ||
                userActivityConditionData.getType() == eGamePlayerEventType.LiveShowWasheWinTimes.getValue()
            ) {
                return true;
            }
        }
        return false;
    }

    public void resetCricketCourtTokenTask() {
        if (activityInfo.getType() != eActivityType.CricketMallActivity.getValue()) {
            return;
        }
        for (UserActivityConditionData conditionData : userActivityConditionDataList) {
            if (conditionData.getType() != eGamePlayerEventType.CricketCourtBronzeToken.getValue()
                    && conditionData.getType() != eGamePlayerEventType.CricketCourtSliverToken.getValue()
                    && conditionData.getType() != eGamePlayerEventType.CricketCourtGoldToken.getValue()) {
                continue;
            }
            conditionData.setValue(BigInteger.ZERO);
            conditionData.setPreValue(BigInteger.ZERO);
            conditionData.setGetReward(false);
            conditionData.setModifyTime(System.currentTimeMillis() / 1000);
            conditionData.setParam("");
        }

        for (BaseActivityCondition condition : baseActivityConditionList) {
            if (condition.getConditionType() != eGamePlayerEventType.CricketCourtBronzeToken.getValue()
                    && condition.getConditionType() != eGamePlayerEventType.CricketCourtSliverToken.getValue()
                    && condition.getConditionType() != eGamePlayerEventType.CricketCourtGoldToken.getValue()) {
                continue;
            }
            condition.addTrigger(player);
        }
        // 同步下数据
        player.getModule(ActivityModule.class).onActivityDataChanged(this);
    }


    /**
    * 描述：代金券重置任务
    * 作者：zrq
    * 时间：2023/4/27
    * 参数：

    * 返回值：
    **/
    public void resetCouponTask() {
        if (activityInfo.getType() != eActivityType.RechargeActivity.getValue() || 17 != activityInfo.getChildType()) {//代金券活动
            return;
        }
        long zeroTime = LocalDateTimeHelper.getZeroTimeTimeStamp() / 1000;
        for (UserActivityConditionData userActivityConditionData : userActivityConditionDataList) {
            if (userActivityConditionData.getType() != eGamePlayerEventType.CouponTrigger.getValue()) {
                continue;
            }
            ActivityConditionInfo activityConditionInfo = NormalActivityMgr.getActivityConditionInfo(userActivityConditionData.getActivityId(), userActivityConditionData.getConditionId());
            if(null == activityConditionInfo){
                continue;
            }
            int resetType = activityConditionInfo.getParamList().get(1).intValue();     //重置类型，0：不重置；1：每日；2：每周；3：每月
            if(1 == resetType){//每日重置
                if (userActivityConditionData.getModifyTime() < zeroTime) {
                    resetBaseActivityCondition(userActivityConditionData.getConditionId());
                }
            }else if(2 == resetType){//每周重置
                if (!DateHelper.isSameWeek(userActivityConditionData.getModifyTime(), zeroTime)) {
                    resetBaseActivityCondition(userActivityConditionData.getConditionId());
                }
            }else if(3 == resetType){//每月重置
                if (!DateHelper.isSameMonth(userActivityConditionData.getModifyTime(), zeroTime)) {
                    resetBaseActivityCondition(userActivityConditionData.getConditionId());
                }
            }
        }
    }

    /**
    * 描述：重置任务并且重新加触发
    * 作者：zrq
    * 时间：2023/4/27
    * 参数：

    * 返回值：
    **/
    private void resetBaseActivityCondition(int conditionId){
        for (BaseActivityCondition baseActivityCondition : baseActivityConditionList) {
            if (baseActivityCondition.getConditionId() == conditionId) {
                baseActivityCondition.setValue(BigInteger.ZERO);
                baseActivityCondition.setPreValue(BigInteger.ZERO);
                baseActivityCondition.setGetReward(false);
                baseActivityCondition.setModifyTime(System.currentTimeMillis() / 1000);
                baseActivityCondition.addTrigger(player);
            }
        }
    }

    public void resetRechargeTriggerTask() {
        if (activityInfo.getType() != eActivityType.RMBMallActivity.getValue()) {//现金礼包活动
            return;
        }
        long zeroTime = LocalDateTimeHelper.getZeroTimeTimeStamp() / 1000;
        for (UserActivityConditionData userActivityConditionData : userActivityConditionDataList) {
            //如果是 老服充值触发 (富甲一方) 的重置
            if (userActivityConditionData.getType() == eGamePlayerEventType.RechargeTrigger.getValue()) {
                ActivityConditionInfo activityConditionInfo = NormalActivityMgr.getActivityConditionInfo(userActivityConditionData.getActivityId(), userActivityConditionData.getConditionId());
                if(null == activityConditionInfo){
                    continue;
                }
                if(activityConditionInfo.getParamList().size() < 8){
                    continue;
                }
                int resetType = activityConditionInfo.getParamList().get(7).intValue();     //重置类型，0：不重置；1：每日；2：每周；3：每月
                if(1 == resetType){//每日重置
                    if (userActivityConditionData.getModifyTime() < zeroTime) {
                        resetTriggerBaseActivityCondition(userActivityConditionData.getConditionId());
                    }
                }else if(2 == resetType){//每周重置
                    if (!DateHelper.isSameWeek(userActivityConditionData.getModifyTime(), zeroTime)) {
                        resetTriggerBaseActivityCondition(userActivityConditionData.getConditionId());
                    }
                }else if(3 == resetType){//每月重置
                    if (!DateHelper.isSameMonth(userActivityConditionData.getModifyTime(), zeroTime)) {
                        resetTriggerBaseActivityCondition(userActivityConditionData.getConditionId());
                    }
                }
            } else {    //现金礼包其他触发的重置
                //运营 陈实 说这里只需要子类型为1的来重置
                if (activityInfo.getChildType() != 1){
                    return;
                }

                ActivityConditionInfo activityConditionInfo = NormalActivityMgr.getActivityConditionInfo(userActivityConditionData.getActivityId(), userActivityConditionData.getConditionId());
                if(null == activityConditionInfo){
                    continue;
                }
                //老表 或者没配重置的不重置
                if(activityConditionInfo.getParamList().size() < 5){
                    continue;
                }
                int resetType = activityConditionInfo.getParamList().get(4).intValue();     //重置类型，0：不重置；1：每日；2：每周；3：每月
                if(1 == resetType){//每日重置
                    if (userActivityConditionData.getModifyTime() < zeroTime) {
                        resetTriggerBaseActivityCondition(userActivityConditionData.getConditionId());
                    }
                }else if(2 == resetType){//每周重置
                    if (!DateHelper.isSameWeek(userActivityConditionData.getModifyTime(), zeroTime)) {
                        resetTriggerBaseActivityCondition(userActivityConditionData.getConditionId());
                    }
                }else if(3 == resetType){//每月重置
                    if (!DateHelper.isSameMonth(userActivityConditionData.getModifyTime(), zeroTime)) {
                        resetTriggerBaseActivityCondition(userActivityConditionData.getConditionId());
                    }
                }
            }

        }
    }

    public void resetSystemOpenRechargeTriggerTask() {
        if (activityInfo.getType() != eActivityType.SystemOpenRMBMallActivity.getValue()) {//系统开放现金礼包活动
            return;
        }
        long zeroTime = LocalDateTimeHelper.getZeroTimeTimeStamp() / 1000;
        for (UserActivityConditionData userActivityConditionData : userActivityConditionDataList) {
            ActivityConditionInfo activityConditionInfo = NormalActivityMgr.getActivityConditionInfo(userActivityConditionData.getActivityId(), userActivityConditionData.getConditionId());
            if (null == activityConditionInfo) {
                continue;
            }
            // 没配重置的不重置
            if (activityConditionInfo.getParamList().size() < 5) {
                continue;
            }
            int resetType = activityConditionInfo.getParamList().get(4).intValue();     //重置类型，0：不重置；1：每日；2：每周；3：每月
            if (1 == resetType) {//每日重置
                if (userActivityConditionData.getModifyTime() < zeroTime) {
                    resetTriggerBaseActivityCondition(userActivityConditionData.getConditionId());
                }
            } else if (2 == resetType) {//每周重置
                if (!DateHelper.isSameWeek(userActivityConditionData.getModifyTime(), zeroTime)) {
                    resetTriggerBaseActivityCondition(userActivityConditionData.getConditionId());
                }
            } else if (3 == resetType) {//每月重置
                if (!DateHelper.isSameMonth(userActivityConditionData.getModifyTime(), zeroTime)) {
                    resetTriggerBaseActivityCondition(userActivityConditionData.getConditionId());
                }
            }

        }
    }

    private void resetTriggerBaseActivityCondition(int conditionId){
        for (BaseActivityCondition baseActivityCondition : baseActivityConditionList) {
            if (baseActivityCondition.getConditionId() == conditionId) {
                baseActivityCondition.setValue(BigInteger.ZERO);
                baseActivityCondition.setPreValue(BigInteger.valueOf(-1));
                baseActivityCondition.setParam("");
                baseActivityCondition.setGetReward(false);
                baseActivityCondition.setModifyTime(System.currentTimeMillis() / 1000);
                baseActivityCondition.addTrigger(player);
            }
        }
    }

    /**
     * 获取condition list，根据conditionType
     * @param conditionType
     * @return
     */
    public List<BaseActivityCondition> getBaseConditionListByConditionType(int conditionType){
    	List<BaseActivityCondition> result = new ArrayList<>();
    	for(BaseActivityCondition baseActivityCondition : baseActivityConditionList){
    		if(baseActivityCondition.getConditionType() == conditionType){
    			result.add(baseActivityCondition);
    		}
    	}
    	return result;
    }
}
